from django.contrib.auth import logout
from django.shortcuts import render, redirect

# Create your views here
from django.views import View

#创建主页面视图
class IndexView(View):
    def get(self,request):
        return render(request,'index.html')


#退出登陆
class LogoutView(View):
    def get(self,request):
        #清除session
        logout(request)

        #清楚cookie
        response = redirect('/')
        response.delete_cookie('username')
        return response
        # del request.COOKIES['username']
        # return redirect('/')
        #


